function bciExecuteGraspCalculation(objID)

for k=1:length(objID), % for each object    
    % start the grasp calculation
    fprintf('Starting grasp calculation for object %i ...',objID(k));
    startTime = GetSecs();
    setRESI('startGrasping','idx',objID(k));
    bciWaitForFinishedAction(0.5);
    % reset the gripper
    fprintf('done! Time:%3.1fs\nResetting gripper ...',GetSecs-startTime);
    startTime = GetSecs();
    setRESI('resetGrasping');
    bciWaitForFinishedAction(0.1);
    fprintf('done! Time:%3.1fs\n',GetSecs-startTime);
end

function bciWaitForFinishedAction(pauseDelay)
isFinished = getRESI('isFinished','finished');
while ~isFinished, % wait until finished
    pause(pauseDelay);
    isFinished = getRESI('isFinished','finished');
end